Skip to main content

Sign your credential

To sign your credential you have to instantiate the KMS to require the credential signing keys.

import { KMSClient } from " @extrimian/kms-client";
import { LANG, Suite } from "@extrimian/kms-core";
const kms = new KMSClient({
lang: LANG.es,
storage: new SecureStorage(),
});

const bbsbls2020 = await kms.getPublicKeysBySuiteType(Suite.Bbsbls2020);

We use the algorithm of bbsbls2020 keys to sign a credential because it allows us the use of selective disclousure and zero knowlegde proof.

KMS provides a signVC method that allows to sign a credential.

const vc = await kms.signVC(
Suite.Bbsbls2020,
bbsbls2020,
credential,
"did:quarkid:zksync:EiCvhchHLnK1HOM1vlQJTSW0TotsNfe34zFbGXisg3fMzA",
"did:quarkid:zksync:EiCvhchHLnK1HOM1vlQJTSW0TotsNfe34zFbGXisg3fMzA#vc-bbsbls",
new AssertionMethodPurpose()
);

Test your code.

console.log(vc);